#!/bin/bash
#-----------------------------------------------------------------------
# File    : rulesort
# Contents: sort output of apriori
# Author  : Christian Borgelt
# History : ??.??.1996 file created
#           27.02.1997 default settings moved to default case
#           26.03.2003 adapted to current apriori version
#-----------------------------------------------------------------------
case $1 in
'-1')
  cmd='s/\(.*(\)\([0-9]*\.[0-9]*\)\(%[,/].*\)/\2#\1\2\3/'
  sopt='-n -r'
  shift;;
'-2')
  cmd='s/\(.*(.*[,/] \)\([0-9]*\.[0-9]*\)\(%.*\)/\2#\1\2\3/'
  sopt='-n -r'
  shift;;
default)
  cmd=''
  sopt='-d'
  ;;
esac
sed "$cmd" $1 | sort $sopt | sed 's/^.*#//' > $2
